﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Text;
using netDxf;
using netDxf.Blocks;
using netDxf.Collections;
using netDxf.Entities;
using netDxf.Header;
using netDxf.Objects;
using netDxf.Tables;
using netDxf.Units;
using Attribute = netDxf.Entities.Attribute;
using Image = netDxf.Entities.Image;
using Point = netDxf.Entities.Point;
using Trace = netDxf.Entities.Trace;
using System.Threading;

namespace TestDxfDocument
{

    class Toolshankswith7_24taperforautomatictoolchanger7
    {
        public static void _Toolshankswith7_24taperforautomatictoolchanger7(Dictionary<string, Object> data)//细柄丝锥
        {
            DxfDocument dxf = new DxfDocument();
            //图层
            Layer contour = new Layer("contour") { Color = AciColor.Cyan };    //轮廓层
            Layer dimensioning = new Layer("dimensioning");    //尺寸层
            Layer refin = new Layer("refin") { Color = AciColor.Red };    //基准线/内轮廓
            refin.Linetype = Linetype.Dashed;
            Layer centre = new Layer("centre") { Color = AciColor.Yellow };    //中心线
            Layer textlayer = new Layer("textlayer") { Color = AciColor.Blue };    //文本层
            Layer hatching = new Layer("hatching") { Color = AciColor.Blue };    //填充层
            centre.Linetype = Linetype.DashDot;
            Layer additionalline = new Layer("additionalline") { Color = AciColor.Cyan };    //附加线
            Layer cutting = new Layer("cutting") { Color = AciColor.Red };    //切削层
            Layer nocutting = new Layer("nocutting");    //非切削层
            Layer skcontour = new Layer("skcontour") { Color = AciColor.Cyan };    //sk轮廓层
            Layer skdimensioning = new Layer("skdimensioning");    //sk尺寸线层
            Layer skrefin = new Layer("skrefin") { Color = AciColor.Red };    //sk基准线/内轮廓
            Layer sktext = new Layer("sktext") { Color = AciColor.Blue };  //sk文本
            Layer skhatching = new Layer("skhatching") { Color = AciColor.Blue };    //sk填充
            Layer skadditionlline = new Layer("skadditionlline") { Color = AciColor.Cyan };    //sk附加线
            Layer skviewcontour = new Layer("skviewcontour") { Color = AciColor.Cyan };    //skview轮廓
            Layer skviewdimensioning = new Layer("skviewdimensioning");    //skview尺寸线层

            //参数
            double pi = Math.PI;
            string path = Convert.ToString(data["path"]);


            double scale = 1; //放大系数


            double hand = Convert.ToDouble(data["hand"]);

            if (hand==0)
            {

                double d1 = Convert.ToDouble(data["d1"]) * scale;
                double d2 = Convert.ToDouble(data["dcon"]) * scale;
                double d3 = Convert.ToDouble(data["df"]) * scale;
                double d4 = Convert.ToDouble(data["dn1"]) * scale;
                double d6 = Convert.ToDouble(data["dn2"]) * scale;
                double d7 = Convert.ToDouble(data["crks"]) * scale;
                double l1 = Convert.ToDouble(data["oal"]) * scale;
                double l2 = Convert.ToDouble(data["lpr"]) * scale;
                double l3 = Convert.ToDouble(data["lf"]) * scale;
                double l4 = l1 - l2;
                double l5 = Convert.ToDouble(data["flgt"]) * scale;
                double l6 = Convert.ToDouble(data["l6"]) * scale;
                double l7 = Convert.ToDouble(data["l7"]) * scale;
                double l8 = Convert.ToDouble(data["ln"]) * scale;
                double l12 = Convert.ToDouble(data["thlgth"]) * scale;

                double c = Convert.ToDouble(data["c"]) * scale;
                double d8 = Convert.ToDouble(data["d8"]) * scale;
                double t = Convert.ToDouble(data["t"]) * scale;



                //坐标
                Vector2 v1 = new Vector2(0, 0);
                Vector2 v2 = new Vector2(v1.X + l1 + 10, v1.Y);
                Vector2 v3 = new Vector2(v1.X + 5, v1.Y);
                Vector2 v5 = new Vector2(v3.X + 1.5, v3.Y + d1 / 2);
                Vector2 v4 = new Vector2(v3.X, v5.Y - 1.5 * Math.Tan(30 * pi / 180));
                Vector2 v6 = new Vector2(v5.X + l2 - l3 - 2, v5.Y);
                Vector2 v7 = fun.Polar(v6, -75 * pi / 180, (d1 - d4) / 2 / Math.Cos(15 * pi / 180));
                Vector2 v8 = new Vector2(v7.X, v7.Y * -1);
                Vector2 v9 = new Vector2(v6.X, v6.Y * -1);
                Vector2 v10 = new Vector2(v5.X, v5.Y * -1);
                Vector2 v11 = new Vector2(v4.X, v4.Y * -1);
                Vector2 v13 = new Vector2(v6.X + l3 - l5, v3.Y + d3 / 2);
                Vector2 v12 = new Vector2(v13.X - (v13.Y - v7.Y), v7.Y);
                Vector2 v14 = new Vector2(v13.X + l5, v13.Y);
                Vector2 v15 = new Vector2(v14.X, v14.Y * -1);
                Vector2 v16 = new Vector2(v13.X, v13.Y * -1);
                Vector2 v17 = new Vector2(v12.X, v12.Y * -1);
                Vector2 v18 = new Vector2(v14.X, v3.Y + d4 / 2 - 0.5);
                Vector2 v19 = new Vector2(v14.X, v18.Y * -1);
                Vector2 v20 = new Vector2(v16.X, v19.Y);
                Vector2 v21 = new Vector2(v13.X, v18.Y);
                Vector2 v22 = new Vector2(v14.X, v3.Y + d2 / 2);
                Vector2 v23 = new Vector2(v22.X + l7 / 2, v22.Y);
                Vector2 v24 = new Vector2(v23.X, v23.Y * -1);
                Vector2 v25 = new Vector2(v15.X, v22.Y * -1);
                Vector2 v26 = new Vector2(v22.X + l7, v22.Y);
                Vector2 v27 = new Vector2(v22.X + l7, v24.Y);
                Vector2 v28 = new Vector2(v26.X, v1.Y + d6 / 2 + 0.2);
                Vector2 v29 = new Vector2(v28.X + l8, v28.Y);
                Vector2 v30 = new Vector2(v28.X, v28.Y * -1);
                Vector2 v31 = new Vector2(v29.X, v30.Y);
                Vector2 v32 = new Vector2(v29.X, v26.Y - 0.3);
                Vector2 v33 = new Vector2(v32.X + 0.3, v26.Y);
                Vector2 v34 = new Vector2(v22.X + l6, v22.Y);
                Vector2 v35 = new Vector2(v34.X, v34.Y * -1);
                Vector2 v36 = new Vector2(v33.X, v33.Y * -1);
                Vector2 v37 = new Vector2(v32.X, v32.Y * -1);
                Vector2 v38 = new Vector2(v34.X + 1, v34.Y - 1);
                Vector2 v39 = new Vector2(v38.X, v38.Y * -1);
                Vector2 v40 = new Vector2(v38.X, v38.Y - 0.5);
                Vector2 v41 = new Vector2(v40.X, v40.Y * -1);
                Vector2 v43 = new Vector2(v22.X + l4 - l12, v1.Y + d7 / 2);
                Vector2 v50 = new Vector2(v43.X - 1.5, v38.Y);
                Vector2 v42 = new Vector2(v43.X - 1.5 * (v43.Y - v40.Y) / (v43.Y - v50.Y), v40.Y);
                Vector2 v45 = new Vector2(v43.X + l12, v50.Y - 0.5);
                Vector2 v44 = new Vector2(v45.X - 1.5, v43.Y);
                Vector2 v51 = new Vector2(v44.X + 1.5 * (v43.Y - v50.Y) / (v44.Y - v45.Y), v50.Y);
                Vector2 v46 = new Vector2(v45.X, v45.Y * -1);
                Vector2 v47 = new Vector2(v44.X, v44.Y * -1);
                Vector2 v53 = new Vector2(v51.X, v51.Y * -1);
                Vector2 v48 = new Vector2(v43.X, v43.Y * -1);
                Vector2 v52 = new Vector2(v50.X, v50.Y * -1);
                Vector2 v49 = new Vector2(v42.X, v42.Y * -1);

                Vector2 v111 = new Vector2(v3.X, v3.Y + d8 / 2);
                Vector2 v112 = new Vector2(v111.X + t, v111.Y - c);
                Vector2 v113 = new Vector2(v112.X, v112.Y * -1);
                Vector2 v114 = new Vector2(v111.X, v111.Y * -1);
                Vector2 v115 = new Vector2(v112.X - 0.3, v112.Y + 0.3);
                Vector2 v116 = new Vector2(v115.X, v115.Y * -1);
                Vector2 v117 = new Vector2(v112.X, v3.Y + d8 / 6);
                Vector2 v118 = new Vector2(v117.X + 1.5, v3.Y);
                Vector2 v119 = new Vector2(v117.X, v117.Y * -1);
                Vector2 v128 = new Vector2(v111.X, v111.Y + 1.5);
                Vector2 v129 = new Vector2(v5.X, v128.Y - 0.1);
                Vector2 v120 = new Vector2(v6.X, v129.Y - 0.2);
                Vector2 v121 = new Vector2(v7.X, v120.Y - 0.1);
                Vector2 v122 = new Vector2(v7.X + 2, v112.Y);
                Vector2 v123 = new Vector2(v122.X, v122.Y * -1);
                Vector2 v124 = new Vector2(v121.X, v121.Y * -1);
                Vector2 v125 = new Vector2(v120.X, v120.Y * -1);
                Vector2 v126 = new Vector2(v129.X, v129.Y * -1);
                Vector2 v127 = new Vector2(v128.X, v128.Y * -1);


                Vector2 v54 = new Vector2(v2.X + l1, v2.Y);
                Vector2 v55 = new Vector2(v54.X - d1 / 2 - 5, v54.Y);
                Vector2 v56 = new Vector2(v54.X + d1 / 2 + 5, v54.Y);
                Vector2 v57 = new Vector2(v54.X, v54.Y + d3 / 2 + 5);
                Vector2 v58 = new Vector2(v54.X, v54.Y - d3 / 2 - 5);
                Vector2 v59 = new Vector2(v54.X - d1 / 2, v18.Y);
                Vector2 v61 = new Vector2(v54.X + d1 / 2, v59.Y);
                Vector2 v60 = new Vector2(v59.X, v59.Y * -1);
                Vector2 v62 = new Vector2(v61.X, v60.Y);


                //作图
                Line line1 = new Line(v1, v2);
                line1.Layer = centre;
                line1.Linetype = Linetype.DashDot;
                line1.LinetypeScale = 3;
                dxf.AddEntity(line1);

                LwPolyline line2 = new LwPolyline();
                line2.Vertexes.Add(new LwPolylineVertex(v129));
                line2.Vertexes.Add(new LwPolylineVertex(v5));
                line2.Vertexes.Add(new LwPolylineVertex(v4));
                line2.Vertexes.Add(new LwPolylineVertex(v11));
                line2.Vertexes.Add(new LwPolylineVertex(v10));
                line2.Vertexes.Add(new LwPolylineVertex(v126));
                fun.PolyFill(dxf, line2, 0.3, contour);

                LwPolyline line3 = new LwPolyline();
                line3.Vertexes.Add(new LwPolylineVertex(v5));
                line3.Vertexes.Add(new LwPolylineVertex(v6));
                line3.Vertexes.Add(new LwPolylineVertex(v120));
                fun.PolyFill(dxf, line3, 0.3, contour);

                LwPolyline line4 = new LwPolyline();
                line4.Vertexes.Add(new LwPolylineVertex(v6));
                line4.Vertexes.Add(new LwPolylineVertex(v7));
                line4.Vertexes.Add(new LwPolylineVertex(v121));
                fun.PolyFill(dxf, line4, 0.3, contour);

                LwPolyline line5 = new LwPolyline();
                line5.Vertexes.Add(new LwPolylineVertex(v7));
                line5.Vertexes.Add(new LwPolylineVertex(v12));
                line5.Vertexes.Add(new LwPolylineVertex(v17));
                line5.Vertexes.Add(new LwPolylineVertex(v8));
                fun.PolyFill(dxf, line5, 0.3, contour);

                LwPolyline line6 = new LwPolyline();
                line6.Vertexes.Add(new LwPolylineVertex(v10));
                line6.Vertexes.Add(new LwPolylineVertex(v9));
                line6.Vertexes.Add(new LwPolylineVertex(v125));
                fun.PolyFill(dxf, line6, 0.3, contour);

                LwPolyline line7 = new LwPolyline();
                line7.Vertexes.Add(new LwPolylineVertex(v9));
                line7.Vertexes.Add(new LwPolylineVertex(v8));
                line7.Vertexes.Add(new LwPolylineVertex(v124));
                fun.PolyFill(dxf, line7, 0.3, contour);

                LwPolyline line8 = new LwPolyline();
                line8.Vertexes.Add(new LwPolylineVertex(v12));
                line8.Vertexes.Add(new LwPolylineVertex(v13));
                line8.Vertexes.Add(new LwPolylineVertex(v14));
                line8.Vertexes.Add(new LwPolylineVertex(v15));
                line8.Vertexes.Add(new LwPolylineVertex(v16));
                line8.Vertexes.Add(new LwPolylineVertex(v17));
                fun.PolyFill(dxf, line8, 0.3, contour);

                LwPolyline line9 = new LwPolyline();
                line9.Vertexes.Add(new LwPolylineVertex(v13));
                line9.Vertexes.Add(new LwPolylineVertex(v21));
                line9.Vertexes.Add(new LwPolylineVertex(v18));
                line9.Vertexes.Add(new LwPolylineVertex(v20));
                line9.Vertexes.Add(new LwPolylineVertex(v19));
                line9.Vertexes.Add(new LwPolylineVertex(v21));
                line9.Vertexes.Add(new LwPolylineVertex(v20));
                line9.Vertexes.Add(new LwPolylineVertex(v16));
                line9.Vertexes[5].Bulge = Math.Tan(97 * pi / 180 / 4);
                fun.PolyFill(dxf, line9, 0.3, contour);

                LwPolyline line10 = new LwPolyline();
                line10.Vertexes.Add(new LwPolylineVertex(v22));
                line10.Vertexes.Add(new LwPolylineVertex(v23));
                line10.Vertexes.Add(new LwPolylineVertex(v24));
                line10.Vertexes.Add(new LwPolylineVertex(v25));
                line10.Vertexes[0].Bulge = Math.Tan(73 * pi / 180 / 4);
                line10.Vertexes[2].Bulge = Math.Tan(73 * pi / 180 / 4);
                fun.PolyFill(dxf, line10, 0.3, contour);

                LwPolyline line11 = new LwPolyline();
                line11.Vertexes.Add(new LwPolylineVertex(v23));
                line11.Vertexes.Add(new LwPolylineVertex(v26));
                line11.Vertexes.Add(new LwPolylineVertex(v27));
                line11.Vertexes.Add(new LwPolylineVertex(v24));
                fun.PolyFill(dxf, line11, 0.3, contour);

                LwPolyline line12 = new LwPolyline();
                line12.Vertexes.Add(new LwPolylineVertex(v28));
                line12.Vertexes.Add(new LwPolylineVertex(v29));
                line12.Vertexes[0].Bulge = Math.Tan(83 * pi / 180 / 4);
                fun.PolyFill(dxf, line12, 0.3, contour);

                LwPolyline line13 = new LwPolyline();
                line13.Vertexes.Add(new LwPolylineVertex(v31));
                line13.Vertexes.Add(new LwPolylineVertex(v30));
                line13.Vertexes[0].Bulge = Math.Tan(83 * pi / 180 / 4);
                fun.PolyFill(dxf, line13, 0.3, contour);

                LwPolyline line14 = new LwPolyline();
                line14.Vertexes.Add(new LwPolylineVertex(v32));
                line14.Vertexes.Add(new LwPolylineVertex(v33));
                line14.Vertexes.Add(new LwPolylineVertex(v34));
                line14.Vertexes.Add(new LwPolylineVertex(v35));
                line14.Vertexes.Add(new LwPolylineVertex(v36));
                line14.Vertexes.Add(new LwPolylineVertex(v37));
                line14.Vertexes.Add(new LwPolylineVertex(v32));
                fun.PolyFill(dxf, line14, 0.3, contour);

                LwPolyline line15 = new LwPolyline();
                line15.Vertexes.Add(new LwPolylineVertex(v34));
                line15.Vertexes.Add(new LwPolylineVertex(v38));
                line15.Vertexes.Add(new LwPolylineVertex(v39));
                line15.Vertexes.Add(new LwPolylineVertex(v35));
                fun.PolyFill(dxf, line15, 0.3, contour);

                LwPolyline line16 = new LwPolyline();
                line16.Vertexes.Add(new LwPolylineVertex(v40));
                line16.Vertexes.Add(new LwPolylineVertex(v42));
                line16.Vertexes.Add(new LwPolylineVertex(v49));
                line16.Vertexes.Add(new LwPolylineVertex(v41));
                fun.PolyFill(dxf, line16, 0.3, contour);

                LwPolyline line17 = new LwPolyline();
                line17.Vertexes.Add(new LwPolylineVertex(v42));
                line17.Vertexes.Add(new LwPolylineVertex(v43));
                line17.Vertexes.Add(new LwPolylineVertex(v48));
                line17.Vertexes.Add(new LwPolylineVertex(v49));
                fun.PolyFill(dxf, line17, 0.3, contour);

                LwPolyline line18 = new LwPolyline();
                line18.Vertexes.Add(new LwPolylineVertex(v43));
                line18.Vertexes.Add(new LwPolylineVertex(v44));
                line18.Vertexes.Add(new LwPolylineVertex(v47));
                line18.Vertexes.Add(new LwPolylineVertex(v48));
                fun.PolyFill(dxf, line18, 0.3, contour);

                LwPolyline line19 = new LwPolyline();
                line19.Vertexes.Add(new LwPolylineVertex(v44));
                line19.Vertexes.Add(new LwPolylineVertex(v45));
                line19.Vertexes.Add(new LwPolylineVertex(v46));
                line19.Vertexes.Add(new LwPolylineVertex(v47));
                fun.PolyFill(dxf, line19, 0.3, contour);

                LwPolyline line20 = new LwPolyline();
                line20.Vertexes.Add(new LwPolylineVertex(v50));
                line20.Vertexes.Add(new LwPolylineVertex(v51));
                fun.PolyFill(dxf, line20, 0.15, contour);

                LwPolyline line21 = new LwPolyline();
                line21.Vertexes.Add(new LwPolylineVertex(v50));
                line21.Vertexes.Add(new LwPolylineVertex(v51));
                fun.PolyFill(dxf, line21, 0.15, contour);

                LwPolyline line22 = new LwPolyline();
                line22.Vertexes.Add(new LwPolylineVertex(v52));
                line22.Vertexes.Add(new LwPolylineVertex(v53));
                fun.PolyFill(dxf, line22, 0.15, contour);

                LwPolyline line23 = new LwPolyline();
                line23.Vertexes.Add(new LwPolylineVertex(v111));
                line23.Vertexes.Add(new LwPolylineVertex(v115));
                line23.Vertexes.Add(new LwPolylineVertex(v112));
                line23.Vertexes.Add(new LwPolylineVertex(v113));
                line23.Vertexes.Add(new LwPolylineVertex(v116));
                line23.Vertexes.Add(new LwPolylineVertex(v114));
                fun.PolyFill(dxf, line23, 0.3, contour);

                LwPolyline line24 = new LwPolyline();
                line24.Vertexes.Add(new LwPolylineVertex(v117));
                line24.Vertexes.Add(new LwPolylineVertex(v118));
                line24.Vertexes.Add(new LwPolylineVertex(v119));
                fun.PolyFill(dxf, line24, 0.3, contour);

                LwPolyline line25 = new LwPolyline();
                line25.Vertexes.Add(new LwPolylineVertex(v128));
                line25.Vertexes.Add(new LwPolylineVertex(v129));
                line25.Vertexes.Add(new LwPolylineVertex(v120));
                line25.Vertexes.Add(new LwPolylineVertex(v121));
                line25.Vertexes.Add(new LwPolylineVertex(v122));
                line25.Vertexes.Add(new LwPolylineVertex(v123));
                line25.Vertexes.Add(new LwPolylineVertex(v124));
                line25.Vertexes.Add(new LwPolylineVertex(v125));
                line25.Vertexes.Add(new LwPolylineVertex(v126));
                line25.Vertexes.Add(new LwPolylineVertex(v127));
                line25.Vertexes[3].Bulge = Math.Tan(-50 * pi / 180 / 4);
                line25.Vertexes[4].Bulge = Math.Tan(8 * pi / 180 / 4);
                line25.Vertexes[5].Bulge = Math.Tan(-50 * pi / 180 / 4);
                fun.PolyFill(dxf, line25, 0.3, contour);

                LwPolyline line26 = new LwPolyline();
                line26.Vertexes.Add(new LwPolylineVertex(v116));
                line26.Vertexes.Add(new LwPolylineVertex(v115));
                fun.PolyFill(dxf, line26, 0.3, contour);


                Line line30 = new Line(v55, v56);
                line30.Layer = centre;
                line30.Linetype = Linetype.DashDot;
                line30.LinetypeScale = 3;
                dxf.AddEntity(line30);

                Line line31 = new Line(v57, v58);
                line31.Layer = centre;
                line31.Linetype = Linetype.DashDot;
                line31.LinetypeScale = 3;
                dxf.AddEntity(line31);

                fun.drawcircle(dxf, v54, d8 / 2, 0.3, contour);

                fun.drawcircle(dxf, v54, d1 / 2, 0.3, contour);

                fun.drawcircle(dxf, v54, (v4.Y - v3.Y), 0.3, contour);

                LwPolyline line32 = new LwPolyline();
                line32.Vertexes.Add(new LwPolylineVertex(v59));
                line32.Vertexes.Add(new LwPolylineVertex(v61));
                line32.Vertexes.Add(new LwPolylineVertex(v62));
                line32.Vertexes.Add(new LwPolylineVertex(v60));
                line32.Vertexes.Add(new LwPolylineVertex(v59));
                line32.Vertexes[0].Bulge = Math.Tan(-111 * pi / 180 / 4);
                line32.Vertexes[2].Bulge = Math.Tan(-111 * pi / 180 / 4);
                fun.PolyFill(dxf, line32, 0.15, contour);


                //填充
                LwPolyline hatchpoly1 = new LwPolyline();
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v120));
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v121));
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v122));
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v123));
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v124));
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v125));
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v126));
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v127));
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v114));
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v116));
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v113));
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v119));
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v118));
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v117));
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v112));
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v115));
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v111));
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v128));
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v129));
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v120));
                hatchpoly1.Vertexes[1].Bulge = Math.Tan(-50 * pi / 180 / 4);
                hatchpoly1.Vertexes[2].Bulge = Math.Tan(8 * pi / 180 / 4);
                hatchpoly1.Vertexes[3].Bulge = Math.Tan(-50 * pi / 180 / 4);
                hatchpoly1.IsClosed = true;
                String[] htype1 = new String[100];
                Line[] hline1 = new Line[100];
                Arc[] harc1 = new Arc[100];
                int hnumst1 = hatchpoly1.Explode().Count;  //记录爆炸后，线段有多少
                for (int i = 0; i < hnumst1; i++)
                {
                    htype1[i] = hatchpoly1.Explode()[i].Type.ToString();    //将所有的元素记录成一个数组
                    if (htype1[i] == "Line")
                    {
                        hline1[i] = (Line)hatchpoly1.Explode()[i];
                    }
                    if (htype1[i] == "Arc")
                    {
                        harc1[i] = (Arc)hatchpoly1.Explode()[i];
                    }
                }
                fun.hatchsub1(dxf, htype1, hnumst1, 45, 10, hline1, harc1, hatching);

            }

            else
            {


                double d1 = Convert.ToDouble(data["d1"]) * scale;
                double d2 = Convert.ToDouble(data["dcon"]) * scale;
                double d3 = Convert.ToDouble(data["df"]) * scale;
                double d4 = Convert.ToDouble(data["dn1"]) * scale;
                double d6 = Convert.ToDouble(data["dn2"]) * scale;
                double d7 = Convert.ToDouble(data["crks"]) * scale;
                double l1 = Convert.ToDouble(data["oal"]) * scale;
                double l2 = Convert.ToDouble(data["lpr"]) * scale;
                double l3 = Convert.ToDouble(data["lf"]) * scale;
                double l4 = l1 - l2;
                double l5 = Convert.ToDouble(data["flgt"]) * scale;
                double l6 = Convert.ToDouble(data["l6"]) * scale;
                double l7 = Convert.ToDouble(data["l7"]) * scale;
                double l8 = Convert.ToDouble(data["ln"]) * scale;
                double l10 = Convert.ToDouble(data["l10"]) * scale;
                double l12 = Convert.ToDouble(data["thlgth"]) * scale;
                double s = Convert.ToDouble(data["drvs"]) * scale;

                double c = Convert.ToDouble(data["c"]) * scale;
                double d8 = Convert.ToDouble(data["d8"]) * scale;
                double t = Convert.ToDouble(data["t"]) * scale;



                Vector2 v1 = new Vector2(0, 0);
                Vector2 v2 = new Vector2(v1.X + l1 + 10, v1.Y);
                Vector2 v3 = new Vector2(v1.X + 5, v1.Y);
                Vector2 v5 = new Vector2(v3.X + l10, v3.Y + d1 / 2);
                Vector2 v4 = new Vector2(v3.X, v5.Y - l10 * Math.Tan(30 * pi / 180));
                Vector2 v6 = new Vector2(v5.X + l2 - l3, v5.Y);
                Vector2 v7 = new Vector2(v6.X + (v6.Y - d4 / 2), v1.Y + d4 / 2);
                Vector2 v8 = new Vector2(v7.X, v7.Y * -1);
                Vector2 v9 = new Vector2(v6.X, v6.Y * -1);
                Vector2 v10 = new Vector2(v5.X, v5.Y * -1);
                Vector2 v11 = new Vector2(v4.X, v4.Y * -1);
                Vector2 v12 = new Vector2(v7.X + l3 - (v6.Y - d4 / 2) - l5 - 2.65, v7.Y - 0.3);
                Vector2 v13 = new Vector2(v12.X + 2.65, v12.Y + 2.65);
                Vector2 v14 = new Vector2(v13.X, v13.Y * -1);
                Vector2 v15 = new Vector2(v12.X, v12.Y * -1);
                Vector2 v16 = new Vector2(v13.X, v3.Y + d3 / 2);
                Vector2 v17 = new Vector2(v16.X + l5, v16.Y);
                Vector2 v18 = new Vector2(v17.X, v17.Y * -1);
                Vector2 v19 = new Vector2(v16.X, v16.Y * -1);
                Vector2 v21 = new Vector2(v17.X, v3.Y + d4 / 2);
                Vector2 v23 = new Vector2(v21.X, v21.Y * -1);
                Vector2 v20 = new Vector2(v16.X, v21.Y);
                Vector2 v22 = new Vector2(v20.X, v23.Y);
                Vector2 v24 = new Vector2(v17.X, v3.Y + d2 / 2);
                Vector2 v25 = new Vector2(v24.X + 1.5, v24.Y);
                Vector2 v26 = new Vector2(v25.X, v25.Y * -1);
                Vector2 v27 = new Vector2(v24.X, v24.Y * -1);
                Vector2 v28 = new Vector2(v24.X + l7, v24.Y);
                Vector2 v29 = new Vector2(v28.X, v28.Y * -1);
                Vector2 v30 = new Vector2(v28.X, v3.Y + d6 / 2 + 0.2);
                Vector2 v31 = new Vector2(v30.X + l8, v30.Y);
                Vector2 v32 = new Vector2(v30.X, v30.Y * -1);
                Vector2 v33 = new Vector2(v31.X, v31.Y * -1);
                Vector2 v34 = new Vector2(v31.X, v24.Y);
                Vector2 v35 = new Vector2(v24.X + l6, v34.Y);
                Vector2 v36 = new Vector2(v35.X, v35.Y * -1);
                Vector2 v37 = new Vector2(v34.X, v34.Y * -1);
                Vector2 v38 = new Vector2(v35.X + 1, v35.Y - 1);
                Vector2 v39 = new Vector2(v38.X, v38.Y * -1);
                Vector2 v44 = new Vector2(v24.X + l4 - l12, v3.Y + d7 / 2);
                Vector2 v46 = new Vector2(v44.X + l12, v44.Y - 0.5);
                Vector2 v45 = new Vector2(v46.X - 0.5, v46.Y + 0.5);
                Vector2 v50 = new Vector2(v44.X - 1, v46.Y);
                Vector2 v40 = new Vector2(v38.X, v46.Y - 0.5);
                Vector2 v41 = new Vector2(v44.X - (v44.Y - v40.Y) / 0.5, v40.Y);
                Vector2 v47 = new Vector2(v46.X, v46.Y * -1);
                Vector2 v48 = new Vector2(v45.X, v45.Y * -1);
                Vector2 v49 = new Vector2(v44.X, v44.Y * -1);
                Vector2 v51 = new Vector2(v50.X, v50.Y * -1);
                Vector2 v42 = new Vector2(v41.X, v41.Y * -1);
                Vector2 v43 = new Vector2(v40.X, v40.Y * -1);

                Vector2 v111 = new Vector2(v3.X, v3.Y + d8 / 2);
                Vector2 v112 = new Vector2(v111.X + t, v111.Y - c);
                Vector2 v113 = new Vector2(v112.X, v112.Y * -1);
                Vector2 v114 = new Vector2(v111.X, v111.Y * -1);
                Vector2 v115 = new Vector2(v112.X - 0.3, v112.Y + 0.3);
                Vector2 v116 = new Vector2(v115.X, v115.Y * -1);
                Vector2 v117 = new Vector2(v112.X, v3.Y + d8 / 6);
                Vector2 v118 = new Vector2(v117.X + 1.5, v3.Y);
                Vector2 v119 = new Vector2(v117.X, v117.Y * -1);
                Vector2 v52 = new Vector2(v3.X, v3.Y + d8 / 2 + 1.5);
                Vector2 v53 = new Vector2(v5.X, v52.Y - 0.1);
                Vector2 v54 = new Vector2(v6.X, v53.Y - 0.7);
                Vector2 v57 = new Vector2(v54.X, v54.Y * -1);
                Vector2 v58 = new Vector2(v53.X, v53.Y * -1);
                Vector2 v59 = new Vector2(v52.X, v52.Y * -1);

                Vector2 v77 = new Vector2(v2.X + l1, v2.Y);
                Vector2 v78 = new Vector2(v77.X - d1 / 2 - 5, v77.Y);
                Vector2 v79 = new Vector2(v77.X + d1 / 2 + 5, v77.Y);
                Vector2 v80 = new Vector2(v77.X, v77.Y + d3 / 2 + 5);
                Vector2 v81 = new Vector2(v77.X, v77.Y - d3 / 2 - 5);
                Vector2 v86 = fun.Polar(v77, Math.Acos(s / 2 / d1 * 2), d1 / 2);
                Vector2 v87 = new Vector2(v86.X, v86.Y * -1);
                Vector2 v82 = new Vector2(v86.X - s, v86.Y);
                Vector2 v83 = new Vector2(v82.X, v82.Y * -1);
                Vector2 v84 = new Vector2(v82.X, v20.Y);
                Vector2 v85 = new Vector2(v84.X, v84.Y * -1);
                Vector2 v88 = new Vector2(v84.X + s, v84.Y);
                Vector2 v89 = new Vector2(v88.X, v85.Y);


                //作图
                Line line1 = new Line(v1, v2);
                line1.Layer = centre;
                line1.Linetype = Linetype.DashDot;
                line1.LinetypeScale = 3;
                dxf.AddEntity(line1);

                LwPolyline line2 = new LwPolyline();
                line2.Vertexes.Add(new LwPolylineVertex(v53));
                line2.Vertexes.Add(new LwPolylineVertex(v5));
                line2.Vertexes.Add(new LwPolylineVertex(v4));
                line2.Vertexes.Add(new LwPolylineVertex(v11));
                line2.Vertexes.Add(new LwPolylineVertex(v10));
                line2.Vertexes.Add(new LwPolylineVertex(v58));
                fun.PolyFill(dxf, line2, 0.3, contour);

                LwPolyline line3 = new LwPolyline();
                line3.Vertexes.Add(new LwPolylineVertex(v54));
                line3.Vertexes.Add(new LwPolylineVertex(v6));
                line3.Vertexes.Add(new LwPolylineVertex(v5));
                fun.PolyFill(dxf, line3, 0.3, contour);

                LwPolyline line4 = new LwPolyline();
                line4.Vertexes.Add(new LwPolylineVertex(v6));
                line4.Vertexes.Add(new LwPolylineVertex(v7));
                line4.Vertexes.Add(new LwPolylineVertex(v8));
                line4.Vertexes.Add(new LwPolylineVertex(v9));
                fun.PolyFill(dxf, line4, 0.3, contour);

                LwPolyline line7 = new LwPolyline();
                line7.Vertexes.Add(new LwPolylineVertex(v7));
                line7.Vertexes.Add(new LwPolylineVertex(v12));
                line7.Vertexes.Add(new LwPolylineVertex(v15));
                line7.Vertexes.Add(new LwPolylineVertex(v8));
                line7.Vertexes[0].Bulge = Math.Tan(39 * pi / 180 / 4);
                line7.Vertexes[2].Bulge = Math.Tan(39 * pi / 180 / 4);
                fun.PolyFill(dxf, line7, 0.3, contour);

                LwPolyline line8 = new LwPolyline();
                line8.Vertexes.Add(new LwPolylineVertex(v16));
                line8.Vertexes.Add(new LwPolylineVertex(v17));
                line8.Vertexes.Add(new LwPolylineVertex(v18));
                line8.Vertexes.Add(new LwPolylineVertex(v19));
                line8.Vertexes.Add(new LwPolylineVertex(v16));
                fun.PolyFill(dxf, line8, 0.3, contour);

                LwPolyline line9 = new LwPolyline();
                line9.Vertexes.Add(new LwPolylineVertex(v12));
                line9.Vertexes.Add(new LwPolylineVertex(v13));
                line9.Vertexes[0].Bulge = Math.Tan(62 * pi / 180 / 4);
                fun.PolyFill(dxf, line9, 0.3, contour);

                LwPolyline line10 = new LwPolyline();
                line10.Vertexes.Add(new LwPolylineVertex(v14));
                line10.Vertexes.Add(new LwPolylineVertex(v15));
                line10.Vertexes[0].Bulge = Math.Tan(62 * pi / 180 / 4);
                fun.PolyFill(dxf, line10, 0.3, contour);

                LwPolyline line11 = new LwPolyline();
                line11.Vertexes.Add(new LwPolylineVertex(v20));
                line11.Vertexes.Add(new LwPolylineVertex(v21));
                line11.Vertexes.Add(new LwPolylineVertex(v22));
                line11.Vertexes.Add(new LwPolylineVertex(v23));
                line11.Vertexes.Add(new LwPolylineVertex(v20));
                fun.PolyFill(dxf, line11, 0.3, contour);

                LwPolyline line12 = new LwPolyline();
                line12.Vertexes.Add(new LwPolylineVertex(v24));
                line12.Vertexes.Add(new LwPolylineVertex(v25));
                line12.Vertexes.Add(new LwPolylineVertex(v26));
                line12.Vertexes.Add(new LwPolylineVertex(v27));
                line12.Vertexes[0].Bulge = Math.Tan(100 * pi / 180 / 4);
                line12.Vertexes[2].Bulge = Math.Tan(100 * pi / 180 / 4);
                fun.PolyFill(dxf, line12, 0.3, contour);

                LwPolyline line13 = new LwPolyline();
                line13.Vertexes.Add(new LwPolylineVertex(v30));
                line13.Vertexes.Add(new LwPolylineVertex(v31));
                line13.Vertexes[0].Bulge = Math.Tan(143 * pi / 180 / 4);
                fun.PolyFill(dxf, line13, 0.3, contour);

                LwPolyline line14 = new LwPolyline();
                line14.Vertexes.Add(new LwPolylineVertex(v33));
                line14.Vertexes.Add(new LwPolylineVertex(v32));
                line14.Vertexes[0].Bulge = Math.Tan(143 * pi / 180 / 4);
                fun.PolyFill(dxf, line14, 0.3, contour);

                LwPolyline line15 = new LwPolyline();
                line15.Vertexes.Add(new LwPolylineVertex(v57));
                line15.Vertexes.Add(new LwPolylineVertex(v9));
                line15.Vertexes.Add(new LwPolylineVertex(v10));
                fun.PolyFill(dxf, line15, 0.3, contour);

                LwPolyline line16 = new LwPolyline();
                line16.Vertexes.Add(new LwPolylineVertex(v25));
                line16.Vertexes.Add(new LwPolylineVertex(v28));
                line16.Vertexes.Add(new LwPolylineVertex(v29));
                line16.Vertexes.Add(new LwPolylineVertex(v26));
                fun.PolyFill(dxf, line16, 0.3, contour);

                LwPolyline line17 = new LwPolyline();
                line17.Vertexes.Add(new LwPolylineVertex(v50));
                line17.Vertexes.Add(new LwPolylineVertex(v46));
                fun.PolyFill(dxf, line17, 0.3, contour);

                LwPolyline line18 = new LwPolyline();
                line18.Vertexes.Add(new LwPolylineVertex(v51));
                line18.Vertexes.Add(new LwPolylineVertex(v47));
                fun.PolyFill(dxf, line18, 0.3, contour);

                LwPolyline line19 = new LwPolyline();
                line19.Vertexes.Add(new LwPolylineVertex(v34));
                line19.Vertexes.Add(new LwPolylineVertex(v35));
                line19.Vertexes.Add(new LwPolylineVertex(v36));
                line19.Vertexes.Add(new LwPolylineVertex(v37));
                line19.Vertexes.Add(new LwPolylineVertex(v34));
                fun.PolyFill(dxf, line19, 0.3, contour);

                LwPolyline line20 = new LwPolyline();
                line20.Vertexes.Add(new LwPolylineVertex(v35));
                line20.Vertexes.Add(new LwPolylineVertex(v38));
                line20.Vertexes.Add(new LwPolylineVertex(v39));
                line20.Vertexes.Add(new LwPolylineVertex(v36));
                fun.PolyFill(dxf, line20, 0.3, contour);

                LwPolyline line21 = new LwPolyline();
                line21.Vertexes.Add(new LwPolylineVertex(v40));
                line21.Vertexes.Add(new LwPolylineVertex(v41));
                line21.Vertexes.Add(new LwPolylineVertex(v42));
                line21.Vertexes.Add(new LwPolylineVertex(v43));
                fun.PolyFill(dxf, line21, 0.3, contour);

                LwPolyline line22 = new LwPolyline();
                line22.Vertexes.Add(new LwPolylineVertex(v41));
                line22.Vertexes.Add(new LwPolylineVertex(v44));
                line22.Vertexes.Add(new LwPolylineVertex(v49));
                line22.Vertexes.Add(new LwPolylineVertex(v42));
                fun.PolyFill(dxf, line22, 0.3, contour);

                LwPolyline line23 = new LwPolyline();
                line23.Vertexes.Add(new LwPolylineVertex(v44));
                line23.Vertexes.Add(new LwPolylineVertex(v45));
                line23.Vertexes.Add(new LwPolylineVertex(v48));
                line23.Vertexes.Add(new LwPolylineVertex(v49));
                fun.PolyFill(dxf, line23, 0.3, contour);

                LwPolyline line24 = new LwPolyline();
                line24.Vertexes.Add(new LwPolylineVertex(v45));
                line24.Vertexes.Add(new LwPolylineVertex(v46));
                line24.Vertexes.Add(new LwPolylineVertex(v47));
                line24.Vertexes.Add(new LwPolylineVertex(v48));
                fun.PolyFill(dxf, line24, 0.3, contour);

                LwPolyline line25 = new LwPolyline();
                line25.Vertexes.Add(new LwPolylineVertex(v52));
                line25.Vertexes.Add(new LwPolylineVertex(v53));
                line25.Vertexes.Add(new LwPolylineVertex(v54));
                line25.Vertexes.Add(new LwPolylineVertex(v57));
                line25.Vertexes.Add(new LwPolylineVertex(v58));
                line25.Vertexes.Add(new LwPolylineVertex(v59));
                line25.Vertexes[2].Bulge = Math.Tan(-40 * pi / 180 / 4);
                line25.Vertexes[3].Bulge = Math.Tan(8 * pi / 180 / 4);
                line25.Vertexes[4].Bulge = Math.Tan(-40 * pi / 180 / 4);
                fun.PolyFill(dxf, line25, 0.3, contour);

                LwPolyline line26 = new LwPolyline();
                line26.Vertexes.Add(new LwPolylineVertex(v45));
                line26.Vertexes.Add(new LwPolylineVertex(v46));
                line26.Vertexes.Add(new LwPolylineVertex(v47));
                line26.Vertexes.Add(new LwPolylineVertex(v48));
                fun.PolyFill(dxf, line26, 0.3, contour);

                LwPolyline line27 = new LwPolyline();
                line27.Vertexes.Add(new LwPolylineVertex(v111));
                line27.Vertexes.Add(new LwPolylineVertex(v115));
                line27.Vertexes.Add(new LwPolylineVertex(v112));
                line27.Vertexes.Add(new LwPolylineVertex(v113));
                line27.Vertexes.Add(new LwPolylineVertex(v116));
                line27.Vertexes.Add(new LwPolylineVertex(v114));
                fun.PolyFill(dxf, line27, 0.3, contour);

                LwPolyline line28 = new LwPolyline();
                line28.Vertexes.Add(new LwPolylineVertex(v117));
                line28.Vertexes.Add(new LwPolylineVertex(v118));
                line28.Vertexes.Add(new LwPolylineVertex(v119));
                fun.PolyFill(dxf, line28, 0.3, contour);

                Line line29 = new Line(v78, v79);
                line29.Layer = centre;
                line29.Linetype = Linetype.DashDot;
                line29.LinetypeScale = 3;
                dxf.AddEntity(line29);

                Line line30 = new Line(v80, v81);
                line30.Layer = centre;
                line30.Linetype = Linetype.DashDot;
                line30.LinetypeScale = 3;
                dxf.AddEntity(line30);

                LwPolyline line31 = new LwPolyline();
                line31.Vertexes.Add(new LwPolylineVertex(v82));
                line31.Vertexes.Add(new LwPolylineVertex(v84));
                line31.Vertexes.Add(new LwPolylineVertex(v88));
                line31.Vertexes.Add(new LwPolylineVertex(v86));
                line31.Vertexes[1].Bulge = Math.Tan(-107 * pi / 180 / 4);
                fun.PolyFill(dxf, line31, 0.3, contour);

                LwPolyline line32 = new LwPolyline();
                line32.Vertexes.Add(new LwPolylineVertex(v87));
                line32.Vertexes.Add(new LwPolylineVertex(v89));
                line32.Vertexes.Add(new LwPolylineVertex(v85));
                line32.Vertexes.Add(new LwPolylineVertex(v83));
                line32.Vertexes[1].Bulge = Math.Tan(-107 * pi / 180 / 4);
                fun.PolyFill(dxf, line32, 0.3, contour);

                fun.drawcircle(dxf, v77, d8 / 2, 0.3, contour);

                fun.drawcircle(dxf, v77, d1 / 2, 0.3, contour);

                fun.drawcircle(dxf, v77, (v4.Y - v3.Y), 0.3, contour);



                //填充
                LwPolyline hatchpoly1 = new LwPolyline();
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v54));
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v57));
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v58));
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v59));
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v114));
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v116));
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v113));
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v119));
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v118));
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v117));
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v112));
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v115));
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v111));
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v52));
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v53));
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v54));
                hatchpoly1.Vertexes[1].Bulge = Math.Tan(-40 * pi / 180 / 4);
                hatchpoly1.Vertexes[2].Bulge = Math.Tan(8 * pi / 180 / 4);
                hatchpoly1.Vertexes[3].Bulge = Math.Tan(-40 * pi / 180 / 4);
                hatchpoly1.IsClosed = true;
                String[] htype1 = new String[100];
                Line[] hline1 = new Line[100];
                Arc[] harc1 = new Arc[100];
                int hnumst1 = hatchpoly1.Explode().Count;  //记录爆炸后，线段有多少
                for (int i = 0; i < hnumst1; i++)
                {
                    htype1[i] = hatchpoly1.Explode()[i].Type.ToString();    //将所有的元素记录成一个数组
                    if (htype1[i] == "Line")
                    {
                        hline1[i] = (Line)hatchpoly1.Explode()[i];
                    }
                    if (htype1[i] == "Arc")
                    {
                        harc1[i] = (Arc)hatchpoly1.Explode()[i];
                    }
                }
                fun.hatchsub1(dxf, htype1, hnumst1, 45, 10, hline1, harc1, hatching);




            }



            double isframe = Convert.ToInt32(data["isframe"]);
            String isframe_chose = Convert.ToString(data["isframe_chose"]);
            Vector2 p0 = new Vector2(0, 0);
            if (isframe == 1)
            {
                if (isframe_chose.Equals("0"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA0X(dxf, new Vector2(p0.X - 1189 / 2.0, p0.Y + 841 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("1"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA1X(dxf, new Vector2(p0.X - 841 / 2.0, p0.Y + 594 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("2"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA2X(dxf, new Vector2(p0.X - 594 / 2.0, p0.Y + 420 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("3"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA3X(dxf, new Vector2(p0.X - 420 / 2.0, p0.Y + 297 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("4X"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA4X(dxf, new Vector2(p0.X - 297 / 2.0, p0.Y + 210 / 2.0 - 10 * 2.26), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("4Y"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA4Y(dxf, new Vector2(p0.X - 210 / 2.0, p0.Y + 297 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }
            }




            //定义格式，路径导出
            dxf.DrawingVariables.AcadVer = DxfVersion.AutoCad2007;
            dxf.Save(path);


        }

    }
}